{extend name="public/base" /}

{block name="title"}<title>{if condition="$data"}{$Think.lang.edit}{else /}{$Think.lang.create}{/if}</title>{/block}

{block name="pjax_container"}
<div class="hry-content-wrapper">
    <section class="content-header">
        <ol class="breadcrumb">
            <li>企业端管理</li>
            <li class="active">项目方列表</li>
            <li class="active">项目方详情</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <form class="form-horizontal" method="POST" action="" onsubmit="return false">
                    <input type="hidden" name="id" value="{$data.id}"/>
                    <div class="nav-tabs-custom">
                        <ul class="nav nav-tabs">
                            <li class="active"><a href="#tab_base" data-toggle="tab">项目方详情</a></li>
                            <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm"
                                                      style="padding:10px 2px;"><i class="fa fa-list"></i>
                                {$Think.lang.back}</a></li>
                        </ul>
                        <div class="tab-content">
                            <div class="tab-pane active" id="tab_base">
                                <div class="project-title">项目方信息</div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">项目方名称</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.company_name}</span></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">项目方介绍</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.company_intro}</span></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">项目方logo</label>
                                    <div class="col-sm-7">
                                        <img src="/uploads/projectuser/logo/{$project_info.logo}" alt="图片"
                                             width="100px" height="120px" style="vertical-align: baseline;">
                                        <a href="javascript:void(0);" class="fangda"
                                           data-url="/uploads/projectuser/logo/{$project_info.logo}">查看大图</a>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">营业执照</label>
                                    <div class="col-sm-7">
                                        <img src="{$project_info.business_license}" alt="图片"
                                             width="100px" height="120px" style="vertical-align: baseline;">
                                        <a href="javascript:void(0);" class="fangda"
                                           data-url="{$project_info.business_license}">查看大图</a>
                                        <a href="{:url('ProjectSide/downLoad')}?id={$project_info.id}&fileName={$project_info.business_license_file_name}">下载图片</a>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">企业法人身份证</label>
                                    <div class="col-sm-7"><img src="{$project_info.legal_person_id_front}"
                                                               alt="图片" width="85px" height="54px"
                                                               style="vertical-align: baseline;">
                                        <a href="javascript:void(0);" class="fangda"
                                           data-url="{$project_info.legal_person_id_front}">查看大图</a>
                                        <a href="{:url('ProjectSide/downLoad')}?id={$project_info.id}&fileName={$project_info.legal_person_id_front_file_name}">下载图片</a>
                                        <!--<a href="javascript:void(0);" class="down_btn_a"-->
                                        <!--data-url="/uploads/avatar/20190404/20190404153458_316403.jpeg">下载图片</a>-->
                                        <img src="{$project_info.legal_person_id_back}" alt="图片"
                                             width="85px" height="54px" style="vertical-align: baseline;">
                                        <a href="javascript:void(0);" class="fangda"
                                           data-url="{$project_info.legal_person_id_back}">查看大图</a>
                                        <a href="{:url('ProjectSide/downLoad')}?id={$project_info.id}&fileName={$project_info.legal_person_id_back_file_name}">下载图片</a></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">法人姓名</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.legal_person}</span></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">法人身份证号码</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.legal_person_id_card}</span></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">法人手机号</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.mobile}</span></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">基本户账号</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.base_count}</span></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">基本户开户行</label>
                                    <div class="col-sm-7"><span class="text-form">{$project_info.base_bank_name}</span></div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">对公开户许可证</label>
                                    <div class="col-sm-7"><img src="{$project_info.company_count}"
                                                               alt="图片" width="85px" height="54px"
                                                               style="vertical-align: baseline;">
                                        <a href="javascript:void(0);" class="fangda"
                                           data-url="{$project_info.company_count}">查看大图</a>
                                        <a href="{:url('ProjectSide/downLoad')}?id={$project_info.id}&fileName={$project_info.company_count_file_name}">下载图片</a>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">企业银行账号</label>
                                    <div class="col-sm-7">
                                        <span class="text-form">{$project_info.base_count}</span>
                                    </div>
                                </div>
                            <div class="project-title">风控审核情况</div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">审核意见</label>
                                <div class="col-sm-7">
                                    <span class="text-form">
                                    {if condition=" $project_info.status==3 "}
                                        拒绝
                                    {else/}
                                        通过
                                    {/if}

                                    </span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">备注信息</label>
                                <div class="col-sm-7"><span class="text-form">{$project_info.systerm_msg}</span></div>
                            </div>
                            <div class="project-title">通联审核情况</div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">审核意见</label>
                                <div class="col-sm-7">
                                    <span class="text-form">
                                    {if condition=" $project_info.status==4 "}
                                        拒绝
                                    {/if}
                                    {if condition=" $project_info.status==5 "}
                                        通过
                                    {/if}
                                    </span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">备注信息</label>
                                <div class="col-sm-7"><span class="text-form">{$project_info.tonglian_msg}</span></div>
                            </div>
                        </div>
                    </div>
                    </div>
                </form>
            </div>
        </div>
    </section>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document" style="width: 60%;overflow: auto;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">图片</h4>
            </div>
            <div class="modal-body">
                <img src="" id="fangdaPic" alt="">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/hry/js/spark-md5.js"></script>
<script type="text/javascript">
    $(function () {
        /*ajax页面加载icheck，有该控件的页面才需要*/
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });

        /*ajax页面加载icheck，有该控件的页面才需要*/
        $(".select2").select2({language: "zh-CN"});

        $('.timepicker').datetimepicker({
            format: 'YYYY-MM-DD HH:mm:ss',   //YYYY-MM-DD HH:mm:ss
            locale: moment.locale('zh-cn')
        });
        $("#ck-jumplink").on('ifChecked', function (event) {
            $("#jumplink").removeClass("hide");
        });
        $('#ck-jumplink').on('ifUnchecked', function (event) {
            $("#jumplink").addClass("hide");
        });
        $(".fangda").on('click', function (event) {
            let url = $(this).attr('data-url')
            $('#fangdaPic').attr('src', url)
            $('#myModal').modal('show')
        });
        $(".down_btn_a").on("click", function () {
            var imgSrc = $(this).attr('data-url');
            //调用创建iframe的函数
            createIframe(imgSrc);
        });
        {if condition = " $rest_login == 1 "}
        restlogin('{$rest_login_info}');   //登录超时
        {/if}
        })

    function createIframe(imgSrc) {
        //如果隐藏的iframe不存在则创建
        if ($("#IframeReportImg").length === 0) {
            $('<iframe style="display:none;" id="IframeReportImg" name="IframeReportImg" onload="downloadImg();" width="0" height="0" src="about:blank"></iframe>').appendTo("body");
        }
        //iframe的src属性如不指向图片地址,则手动修改,加载图片
        if ($('#IframeReportImg').attr("src") != imgSrc) {
            $('#IframeReportImg').attr("src", imgSrc);
        } else {
            //如指向图片地址,直接调用下载方法
            downloadImg();
        }
    }

    //下载图片的函数
    function downloadImg() {
        //iframe的src属性不为空,调用execCommand(),保存图片
        if ($('#IframeReportImg').src != "about:blank") {
            window.frames["IframeReportImg"].document.execCommand("SaveAs");
        }
    }

    $("#file").change(function () {
        var v = $('#file').val();
        var reader = new FileReader();
        reader.readAsDataURL(this.files[0]);
        reader.onload = function (e) {
//            console.log(e.target.result);
            $('#file_base64').val(e.target.result);
        };
        calculate();
    });

    function calculate() {
        var fileReader = new FileReader(),
            blobSlice = File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice,
            file = document.getElementById("file").files[0],
            chunkSize = 2097152,
            // read in chunks of 2MB
            chunks = Math.ceil(file.size / chunkSize),
            currentChunk = 0,
            spark = new SparkMD5();

        fileReader.onload = function (e) {
            spark.appendBinary(e.target.result); // append binary string
            currentChunk++;

            if (currentChunk < chunks) {
                loadNext();
            } else {
                $('#file_md5').val(spark.end());
                console.log(spark.end());

            }
        };

        function loadNext() {
            var start = currentChunk * chunkSize,
                end = start + chunkSize >= file.size ? file.size : start + chunkSize;

            fileReader.readAsBinaryString(blobSlice.call(file, start, end));
        };
        loadNext();
    }
</script>
<style>
    .text-form {
        padding-top: 7px;
        display: inline-block;
    }

    .project-title {
        font-size: 18px;
        margin: 20px 0 20px 18px;
    }

    .project-title:before {
        content: '|';
        font-weight: bolder;
        color: #00c0dc;
        margin-right: 14px;
    }
</style>
{/block}